<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<SCRIPT language="JavaScript1.2">
function openwindow()
{
  window.open("http://www.javascript-coder.com","mywindow","menubar=1,resizable=1,width=350,height=250");
}
</SCRIPT>
<div class="list">
<table>
  <tr>
    <th>No.</th>
    <th>S</th>
    <th width="300">Message</th>
    <th>Annotations</th>
  </tr>
    <c:forEach items="${conversation.messages}" var="message">
    <tr>
      <td><c:out value="${message.sequence}" /></td>
      <td><c:if test="${message.speaker == 1}">
        <font style="color: red">L</font>
      </c:if> <c:if test="${message.speaker == 2}">
        <font style="color: blue">U</font>
      </c:if></td>
      <td><c:out escapeXml="false" value="${message.contentString}" /> <br /> <br />

      <c:if test="${message.note != ''}">
        <a title="Note: <c:out value='${message.note}'/>">[note]</a>
      </c:if>
      <c:if test="${anno_user.role == 1}">       
       <a href='annotatemessage.html?messageId=<c:out value="${message.messageId}"/>'>[annotate]</a>
       <a href='enterda.html?messageId=<c:out value="${message.messageId}"/>'>[new]</a>
     </c:if>
     <% if (request.getParameter("mode").equals("browse")) { %>
       <a href='browsemessage.html?messageId=<c:out value="${message.messageId}"/>'>[browse]</a>
     <% } else { %>
       <a href='annotatemessage.html?messageId=<c:out value="${message.messageId}"/>'>[annotate]</a>
       <a href='enterda.html?messageId=<c:out value="${message.messageId}"/>'>[new]</a>
     <% } %>       
      </td>
      <td>
        <c:forEach items="${message.sortedDialogueActs}" var="da">
          <c:if test="${da.user.userId == anno_user.userId}">
          <div class="inner"><table>
            <tr>
          		<td class='<c:out value="${da.function.labelClass}"/>' colspan="2">
          			<c:out value="${da.textSegment}" />
          		</td>
          		</tr>
          		<tr>
          		<td colspan="2">
          		<% if (! request.getParameter("mode").equals("browse")) { %>          		
          			<a href='enterda.html?messageId=<c:out value="${message.messageId}"/>&daId=<c:out value="${da.dialogueActId}"/>'>
          				[edit]
          			</a>
      					<a onClick="return confirmSubmit();" href="annotateconversation.html?conversationId=<c:out value='${conversation.conversationId}'/>&delDaId=<c:out value='${da.dialogueActId}'/>">
      						[delete]                                 
      					</a>
      			 <% } %>          			
          		</td>
          	</tr>
          	<tr>
         		  <td> 
         		    <c:out value="${da.function.label}" />
         		  </td>
          	  <td>
            		<c:if test="${da.domain != null}">   
									<c:out value="${da.domain.label}" />							
              	</c:if>
              </td>
	          </tr>
					<c:if test="${da.adjacency != null || da.adjacency.label == 'NA'}">
						<tr>
							<td><c:out value="${da.adjacency.label}" /></td>

							<c:if test="${da.adjacentDialogueAct != null}">
								<td><c:out value="${da.adjacentDialogueAct.textSegment}" /></td>
							</c:if>
						</tr>
					</c:if>
				</table></div>
				</c:if>
        </c:forEach> 
      </td>
    </tr>
  </c:forEach>
</table>
</div>
